﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>考生历史考场</title>
    <link href="../css/main.css" rel="stylesheet" type="text/css" />
    <link href="../css/Jqbox.css" rel="stylesheet" type="text/css" />
    <link href="../css/jquery.loadmask.css" rel="stylesheet" type="text/css" />
    <script src="../js/jquery-1.5.2.min.js" type="text/javascript"></script>
    <script src="../js/ligerui.min.js" type="text/javascript"></script>
    <script src="../Js/jquery.dialog.js" type="text/javascript"></script>
    <script src="../Js/conmon.js" type="text/javascript"></script>
    <script src="../Js/jquery.loadmask.min.js" type="text/javascript"></script>
     <script type="text/javascript">
　　         //获得参数的方法
         var request = {
             QueryString: function (val) {
                 var uri = window.location.search;
                 var re = new RegExp("" + val + "=([^&?]*)", "ig");
                 return ((uri.match(re)) ? (uri.match(re)[0].substr(val.length + 1)) : null);
             }
         }

         $(function () {
             //获取参数
             if (request.QueryString("userid") != null) {
                 this.userid = request.QueryString("userid");
             }
             else {
                 showErrorTip("参数错误！");
                 return;
             }

             //显示gride
             $grid = $("#divGrid").ligerGrid({
                 columns: [
               { display: '序号', align: 'center', width: 40, type: 'int', isSort: false,
                   render: function (item, i) {
                       i = i + 1;
                       return i;
                   }
               },
               { display: '考场名称', name: 'examname', align: 'left', width: 90 },
               { display: '总分', align: 'center', width: 90,
                   render: function (item) {
                       return item.total + " 分";
                   }
               },
               { display: '考生得分', align: 'center', width: 100,
                   render: function (item) {
                       return "<span style='color:" + (parseInt(item.passsce) > item.candisrouce ? "#FF3333" : "#228B22") +
                        " '>" + item.candisrouce + " 分</span>"
                   }
               },
               { display: '合格分数', align: 'center', width: 100,
                   render: function (item) {
                       return item.passsce + " 分";
                   }
               },
               { display: '考试时长', align: 'center', width: 90,
                   render: function (item) {
                       return item.examtime + " 分钟";
                   }
               },
               { display: '考生用时', align: 'center', width: 100,
                   render: function (item) {
                       return item.canditime + " 分钟";
                   }
               },
               { display: '参加考试时间', align: 'center', width: 100,
                   render: function (item) {
                       return item.candidate + " 分钟";
                   }
               },
               { display: '状态', align: 'center', width: 70,
                   render: function (item) {

                       switch (item.candistate) {
                           case "-1":
                               return "<a href='#' onclick='CalcScore(" + item.C_ID + ",&quot;" + item.has_QA + "&quot;);'>【评分】</a>";
                           case "-2":
                               return "【未参考】"
                           case "0":
                               return "<a href='#' onclick='Score_QA(" + item.C_ID + ",&quot;" + item.has_QA + "&quot;);'>【阅卷】</a>";
                           case "1":
                               return "【不合格】";
                           case "2":
                               return "【合格】";
                           default:
                               return "*";
                       }
                   }
               },
               { display: '操作', align: 'center', width: 180,
                   render: function (item) {
                       var state = parseInt(item.candistate);
                       var result = "";
                       if (state > 0) {
                           result += "<a href=\"TestView.htm?kc=" + item.candiid + "&exid=" + item.examid + "\" target=\"_blank\">查看考卷</a>&nbsp;&nbsp;";
                       }

                       if (state != -2) {
                           result += "<a href='#' onclick='reexam(" + item.candiid + ")'>重考</a>";
                       }

                       return result;
                   }
               }

               ],
                 parms: [{ name: 'userid', value: this.userid}],
                 dataAction: 'server', pageSize: 50,
                 sortName: 'canditime',
                 sortOrder: 'desc',
                 url: '../WebServer/ExamRoom.ashx?Action=UserExam&rnd=' + Math.random().toString(),
                 width: '99%', height: '95%'
             });
         });

         function loadGrid() {
             if (!$grid) return;
             $grid.setOptions({ parms: [{ name: 'userid', value: this.userid}], newPage: 1, Rows: [], Total: 0});   //设置数据参数
             $grid.loadData(true); //加载数据
         }

         //评分
         function CalcScore(id, has_QA) {
             //alert(has_QA);
             //首先评分
             $("#divContent").mask("数据处理中，请稍候......");
             var params = { C_ID: id, rnd: Math.random() };
             $.getJSON("../WebServer/ExamRoom.ashx?Action=CalcScore", params, function (msg) {
                 $("#divContent").unmask();
                 if (msg == null) {
                     showErrorTip("评分失败，请重试！");
                     return;
                 }
                 if (msg.IsSuccess == 1) {
                     showAlertOk("评分成功");
                     $grid.loadData(true); //加载数据
                 }
             });
             //如果是含有问答题，则同时阅卷
             Score_QA(id, has_QA);
         }

         //阅卷
         var C_ID = 0;
         function Score_QA(id, has_QA) {
             if (has_QA=="True") {
                 C_ID = id;
                 ShowDialog("ExamMng/ScoreQA.htm", "编辑", 900, 550);
             }
         }
         //
         var cName = "";


         function reexam(cid) {
             jqConfirm("该操作将重置该考生的考试记录,该次考试记录作废.确定需要重置考试记录吗?", "重置考试",
                function (action) {
                    if (action == "ok") {
                        $("body").mask("数据处理中，请稍候......");
                        $.post('../WebServer/ExamRoom.ashx?Action=ReExamRoom', { candidateid: cid  }, function (data) {
                            $("body").unmask();
                            var rdata = eval("(" + data + ")");
                            if (rdata.IsSuccess > 0) {
                                showAlertOk("修改成功.");
                                loadGrid.call(document);
                            } else {
                                showErrorTip("考试资料修改失败.");
                            }
                        });
                        // if end
                    }
                }
             );
         }


     </script>
</head>
<body>
    <div id="divContent">
    <div id="divGrid">
    </div>
    </div>
    <iframe id="frmTestView" height="0px" width="0px" style="display:none"></iframe>
    <a id="ExportLink" href="" target="_blank"></a>
</body>
</html>
